import defaultState from './state'
import {combineReducers} from 'redux'

const headReducer = function (state = defaultState.headStatus, action) {
    let {type, payload} = action;
    switch (type) {
        case 'SHOW_HEAD':
            return Object.assign({}, state, {
                headStatus: true
            });
        case 'HIDE_HEAD':
            return Object.assign({}, state, {
                headStatus: false
            });
        default:
            return state;
    }
};
const footReducer = function (state = defaultState.footStatus, action) {
    let {type, payload} = action;
    switch (type) {
        case 'SHOW_FOOT':

            return Object.assign({}, state, {
                footStatus: true
            });
        case 'HIDE_FOOT':
            return Object.assign({}, state, {
                footStatus: false
            });
        default:
            return state;
    }
};
const listReducer = function (state = defaultState.list, action) {
    let {type, list} = action;
    switch (type) {
        case 'GET_LIST':
            return Object.assign({}, state, {
                list: list
            });
        default:
            return state;
    }
};
const allReducers = {
    headReducer: headReducer,
    footReducer: footReducer,
    listReducer: listReducer,
};
const rootReducer = combineReducers(allReducers);
export default rootReducer